package day07;

import java.util.Scanner;

public class CalTotalAvg1 {
    public static void main(String[] args) {
        double[] scores=enterData();
        double he=calTotal(scores);
        System.out.println("he:"+he);
        double cal=calAvg(scores);
        System.out.println("平均分为:"+cal);

    }
    public static double[]enterData(){
        Scanner sc=new Scanner(System.in);
        double[] scores=new double[6];
        for (int i=0;i<scores.length;i++){
            System.out.println("第"+(i+1)+"个评委的分数为:");
            scores[i]=sc.nextDouble();
        }
        return scores;
    }
    public static double calTotal(double[]scores){
        double he=0.0;
        double max=scores[0];
        double min=scores[0];
        for (int i=0;i<scores.length;i++){
            if (scores[i]>max){
                max=scores[i];
            }
            if (scores[i]<min){
                min=scores[i];
            }
            he+=scores[i];
        }
        return he-max-min;
    }
    public static double calAvg(double[]scores){
        double he=calTotal(scores);
        double caL=he/(scores.length-2);
        return caL;
    }
}
